<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>My Project: my_tree&lt; T &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search',true);
  $(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(function(){initNavTree('classmy__tree.html','','classmy__tree-members'); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="headertitle"><div class="title">my_tree&lt; T &gt; Class Template Reference</div></div>
</div><!--header-->
<div class="contents">

<p>二叉树类（模板类，支持任意数据类型T）  
 <a href="#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="my__tree_8h_source.html">my_tree.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pub-methods" class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a9c79fe45a5aae4cbb2efbc5bb050a135" id="r_a9c79fe45a5aae4cbb2efbc5bb050a135"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9c79fe45a5aae4cbb2efbc5bb050a135">my_tree</a> (T val=0)</td></tr>
<tr class="memdesc:a9c79fe45a5aae4cbb2efbc5bb050a135"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造函数  <br /></td></tr>
<tr class="memitem:ab1c9be9f0c6b3fee4b3322841014b8a3" id="r_ab1c9be9f0c6b3fee4b3322841014b8a3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab1c9be9f0c6b3fee4b3322841014b8a3">get_root</a> ()</td></tr>
<tr class="memdesc:ab1c9be9f0c6b3fee4b3322841014b8a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">树的根的编号  <br /></td></tr>
<tr class="memitem:af25baab5cde301d7087d8c5f63727a8f" id="r_af25baab5cde301d7087d8c5f63727a8f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af25baab5cde301d7087d8c5f63727a8f">get_children</a> (vector&lt; int &gt; &amp;children, int root)</td></tr>
<tr class="memdesc:af25baab5cde301d7087d8c5f63727a8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">把某个节点对应的直接的孩子们压入向量中  <br /></td></tr>
<tr class="memitem:a225822fd474ed642ee22901b918bd759" id="r_a225822fd474ed642ee22901b918bd759"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a225822fd474ed642ee22901b918bd759">get_children</a> (queue&lt; int &gt; &amp;children, int root)</td></tr>
<tr class="memdesc:a225822fd474ed642ee22901b918bd759"><td class="mdescLeft">&#160;</td><td class="mdescRight">把某个节点对应的直接的孩子们压入队列中  <br /></td></tr>
<tr class="memitem:a532dfbc3d3835014944957a61b7a8bce" id="r_a532dfbc3d3835014944957a61b7a8bce"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a532dfbc3d3835014944957a61b7a8bce">get_height</a> (int index)</td></tr>
<tr class="memdesc:a532dfbc3d3835014944957a61b7a8bce"><td class="mdescLeft">&#160;</td><td class="mdescRight">得到树高  <br /></td></tr>
<tr class="memitem:a6d1fb6a1cb4a9064cb2538d1fbaa8b06" id="r_a6d1fb6a1cb4a9064cb2538d1fbaa8b06"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a6d1fb6a1cb4a9064cb2538d1fbaa8b06">get_height</a> ()</td></tr>
<tr class="memdesc:a6d1fb6a1cb4a9064cb2538d1fbaa8b06"><td class="mdescLeft">&#160;</td><td class="mdescRight">得到树高  <br /></td></tr>
<tr class="memitem:a2cef5c6b97d67ca6a49b0577600f5254" id="r_a2cef5c6b97d67ca6a49b0577600f5254"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2cef5c6b97d67ca6a49b0577600f5254">get_h_layer_nodes</a> (int h)</td></tr>
<tr class="memdesc:a2cef5c6b97d67ca6a49b0577600f5254"><td class="mdescLeft">&#160;</td><td class="mdescRight">得到h层的节点数  <br /></td></tr>
<tr class="memitem:a3b2c0f604e05f25ffd37a6d0f45a2a26" id="r_a3b2c0f604e05f25ffd37a6d0f45a2a26"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3b2c0f604e05f25ffd37a6d0f45a2a26">get_last_layer_nodes</a> ()</td></tr>
<tr class="memdesc:a3b2c0f604e05f25ffd37a6d0f45a2a26"><td class="mdescLeft">&#160;</td><td class="mdescRight">得到最后一层的节点数  <br /></td></tr>
<tr class="memitem:a826f12f2e9f55f7436fa8d3e1d41da93" id="r_a826f12f2e9f55f7436fa8d3e1d41da93"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a826f12f2e9f55f7436fa8d3e1d41da93">get_nodes_nums</a> ()</td></tr>
<tr class="memdesc:a826f12f2e9f55f7436fa8d3e1d41da93"><td class="mdescLeft">&#160;</td><td class="mdescRight">树的总节点数  <br /></td></tr>
<tr class="memitem:afbfe59f624cf7f8a7f8ebb3cc9ad4514" id="r_afbfe59f624cf7f8a7f8ebb3cc9ad4514"><td class="memItemLeft" align="right" valign="top">T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#afbfe59f624cf7f8a7f8ebb3cc9ad4514">get_value</a> ()</td></tr>
<tr class="memdesc:afbfe59f624cf7f8a7f8ebb3cc9ad4514"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印根节点值  <br /></td></tr>
<tr class="memitem:a00b270f7f42b067702dadafc78f04bf6" id="r_a00b270f7f42b067702dadafc78f04bf6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a00b270f7f42b067702dadafc78f04bf6">show_k_node</a> (int k)</td></tr>
<tr class="memdesc:a00b270f7f42b067702dadafc78f04bf6"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印第k个  <br /></td></tr>
<tr class="memitem:a0d6043fc3e177a775f837fc9dfaea31a" id="r_a0d6043fc3e177a775f837fc9dfaea31a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0d6043fc3e177a775f837fc9dfaea31a">insert</a> (<a class="el" href="struct_tree_node.html">TreeNode</a>&lt; T &gt; node)</td></tr>
<tr class="memdesc:a0d6043fc3e177a775f837fc9dfaea31a"><td class="mdescLeft">&#160;</td><td class="mdescRight">插入新节点  <br /></td></tr>
<tr class="memitem:a49e765fa53962f4ce7d11d6cdb8a12ad" id="r_a49e765fa53962f4ce7d11d6cdb8a12ad"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a49e765fa53962f4ce7d11d6cdb8a12ad">show_binary_tree_with_root</a> (string mode, int root)</td></tr>
<tr class="memdesc:a49e765fa53962f4ce7d11d6cdb8a12ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印根和他的所有孩子  <br /></td></tr>
<tr class="memitem:a0020d5a85f5d99734466c6ef5d255b72" id="r_a0020d5a85f5d99734466c6ef5d255b72"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0020d5a85f5d99734466c6ef5d255b72">show_binary_tree</a> (string mode)</td></tr>
<tr class="memdesc:a0020d5a85f5d99734466c6ef5d255b72"><td class="mdescLeft">&#160;</td><td class="mdescRight">遍历打印  <br /></td></tr>
<tr class="memitem:aadec19d1d256df1f27412e80bd6579d1" id="r_aadec19d1d256df1f27412e80bd6579d1"><td class="memTemplParams" colspan="2">template&lt;typename Function&gt; </td></tr>
<tr class="memitem:aadec19d1d256df1f27412e80bd6579d1 template"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aadec19d1d256df1f27412e80bd6579d1">traversal_binary_tree_with_root</a> (string mode, int root, Function F)</td></tr>
<tr class="memdesc:aadec19d1d256df1f27412e80bd6579d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印根和他的所有孩子  <br /></td></tr>
<tr class="memitem:a99d1637e88625af9f06b6d020730f634" id="r_a99d1637e88625af9f06b6d020730f634"><td class="memTemplParams" colspan="2">template&lt;typename Function&gt; </td></tr>
<tr class="memitem:a99d1637e88625af9f06b6d020730f634 template"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a99d1637e88625af9f06b6d020730f634">traversal_binary_tree</a> (string mode, Function F)</td></tr>
<tr class="memdesc:a99d1637e88625af9f06b6d020730f634"><td class="mdescLeft">&#160;</td><td class="mdescRight">遍历打印  <br /></td></tr>
<tr class="memitem:a908b1d95027e3afb39e7e33b59de10b9" id="r_a908b1d95027e3afb39e7e33b59de10b9"><td class="memItemLeft" align="right" valign="top">T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a908b1d95027e3afb39e7e33b59de10b9">operator[]</a> (int index)</td></tr>
<tr class="memdesc:a908b1d95027e3afb39e7e33b59de10b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">操作符重载[]  <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-friends" class="groupheader"><a id="friends" name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:aa1da950e13ff2a3c6fcaca11015a4e20" id="r_aa1da950e13ff2a3c6fcaca11015a4e20"><td class="memItemLeft" align="right" valign="top">ostream &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa1da950e13ff2a3c6fcaca11015a4e20">operator&lt;&lt;</a> (ostream &amp;os, <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt; Tree)</td></tr>
<tr class="memdesc:aa1da950e13ff2a3c6fcaca11015a4e20"><td class="mdescLeft">&#160;</td><td class="mdescRight">操作符重载&lt;&lt;  <br /></td></tr>
<tr class="memitem:a9aa06543930fa8ddb21c1ebabbff3ecf" id="r_a9aa06543930fa8ddb21c1ebabbff3ecf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9aa06543930fa8ddb21c1ebabbff3ecf">print_node</a> (<a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt; Tree, int x)</td></tr>
<tr class="memdesc:a9aa06543930fa8ddb21c1ebabbff3ecf"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印节点，后续用来bind之后传入traversal  <br /></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><div class="compoundTemplParams">template&lt;typename T&gt;<br />
class my_tree&lt; T &gt;</div><p>二叉树类（模板类，支持任意数据类型T） </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>二叉树节点存储的数据类型 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd>
<dd>
这样感觉好一点 </dd></dl>
</div><a name="doc-constructors" id="doc-constructors"></a><h2 id="header-doc-constructors" class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a9c79fe45a5aae4cbb2efbc5bb050a135" name="a9c79fe45a5aae4cbb2efbc5bb050a135"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c79fe45a5aae4cbb2efbc5bb050a135">&#9670;&#160;</a></span>my_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;<a class="el" href="classmy__tree.html">::my_tree</a> </td>
          <td>(</td>
          <td class="paramtype">T</td>          <td class="paramname"><span class="paramname"><em>val</em></span><span class="paramdefsep"> = </span><span class="paramdefval">0</span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>构造函数 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">val</td><td>当前节点值 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Member Function Documentation</h2>
<a id="a225822fd474ed642ee22901b918bd759" name="a225822fd474ed642ee22901b918bd759"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a225822fd474ed642ee22901b918bd759">&#9670;&#160;</a></span>get_children() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_children </td>
          <td>(</td>
          <td class="paramtype">queue&lt; int &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>children</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>root</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>把某个节点对应的直接的孩子们压入队列中 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">children</td><td>压入的队列 </td></tr>
    <tr><td class="paramname">root</td><td>某个节点 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="af25baab5cde301d7087d8c5f63727a8f" name="af25baab5cde301d7087d8c5f63727a8f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af25baab5cde301d7087d8c5f63727a8f">&#9670;&#160;</a></span>get_children() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_children </td>
          <td>(</td>
          <td class="paramtype">vector&lt; int &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>children</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>root</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>把某个节点对应的直接的孩子们压入向量中 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">children</td><td>压入的向量 </td></tr>
    <tr><td class="paramname">root</td><td>某个节点 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a2cef5c6b97d67ca6a49b0577600f5254" name="a2cef5c6b97d67ca6a49b0577600f5254"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2cef5c6b97d67ca6a49b0577600f5254">&#9670;&#160;</a></span>get_h_layer_nodes()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_h_layer_nodes </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>h</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>得到h层的节点数 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h</td><td>h层 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a6d1fb6a1cb4a9064cb2538d1fbaa8b06" name="a6d1fb6a1cb4a9064cb2538d1fbaa8b06"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d1fb6a1cb4a9064cb2538d1fbaa8b06">&#9670;&#160;</a></span>get_height() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_height </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>得到树高 </p>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a532dfbc3d3835014944957a61b7a8bce" name="a532dfbc3d3835014944957a61b7a8bce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a532dfbc3d3835014944957a61b7a8bce">&#9670;&#160;</a></span>get_height() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_height </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>index</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>得到树高 </p>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a3b2c0f604e05f25ffd37a6d0f45a2a26" name="a3b2c0f604e05f25ffd37a6d0f45a2a26"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b2c0f604e05f25ffd37a6d0f45a2a26">&#9670;&#160;</a></span>get_last_layer_nodes()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_last_layer_nodes </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>得到最后一层的节点数 </p>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a826f12f2e9f55f7436fa8d3e1d41da93" name="a826f12f2e9f55f7436fa8d3e1d41da93"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a826f12f2e9f55f7436fa8d3e1d41da93">&#9670;&#160;</a></span>get_nodes_nums()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_nodes_nums </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>树的总节点数 </p>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="ab1c9be9f0c6b3fee4b3322841014b8a3" name="ab1c9be9f0c6b3fee4b3322841014b8a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab1c9be9f0c6b3fee4b3322841014b8a3">&#9670;&#160;</a></span>get_root()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_root </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>树的根的编号 </p>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="afbfe59f624cf7f8a7f8ebb3cc9ad4514" name="afbfe59f624cf7f8a7f8ebb3cc9ad4514"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afbfe59f624cf7f8a7f8ebb3cc9ad4514">&#9670;&#160;</a></span>get_value()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::get_value </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印根节点值 </p>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a0d6043fc3e177a775f837fc9dfaea31a" name="a0d6043fc3e177a775f837fc9dfaea31a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d6043fc3e177a775f837fc9dfaea31a">&#9670;&#160;</a></span>insert()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::insert </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_tree_node.html">TreeNode</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>node</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>插入新节点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node被插入的新节点</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a908b1d95027e3afb39e7e33b59de10b9" name="a908b1d95027e3afb39e7e33b59de10b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a908b1d95027e3afb39e7e33b59de10b9">&#9670;&#160;</a></span>operator[]()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::operator[] </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>index</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>操作符重载[] </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">index</td><td>要索引的位置 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a0020d5a85f5d99734466c6ef5d255b72" name="a0020d5a85f5d99734466c6ef5d255b72"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0020d5a85f5d99734466c6ef5d255b72">&#9670;&#160;</a></span>show_binary_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::show_binary_tree </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>遍历打印 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode遍历的模式</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a49e765fa53962f4ce7d11d6cdb8a12ad" name="a49e765fa53962f4ce7d11d6cdb8a12ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a49e765fa53962f4ce7d11d6cdb8a12ad">&#9670;&#160;</a></span>show_binary_tree_with_root()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::show_binary_tree_with_root </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>root</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印根和他的所有孩子 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>遍历的模式 </td></tr>
    <tr><td class="paramname">root</td><td>根 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a00b270f7f42b067702dadafc78f04bf6" name="a00b270f7f42b067702dadafc78f04bf6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a00b270f7f42b067702dadafc78f04bf6">&#9670;&#160;</a></span>show_k_node()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::show_k_node </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>k</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印第k个 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">k</td><td>要打印的索引 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a99d1637e88625af9f06b6d020730f634" name="a99d1637e88625af9f06b6d020730f634"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99d1637e88625af9f06b6d020730f634">&#9670;&#160;</a></span>traversal_binary_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<div class="memtemplate">
template&lt;typename Function&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::traversal_binary_tree </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Function</td>          <td class="paramname"><span class="paramname"><em>F</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>遍历打印 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode遍历的模式</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="aadec19d1d256df1f27412e80bd6579d1" name="aadec19d1d256df1f27412e80bd6579d1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aadec19d1d256df1f27412e80bd6579d1">&#9670;&#160;</a></span>traversal_binary_tree_with_root()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<div class="memtemplate">
template&lt;typename Function&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;::traversal_binary_tree_with_root </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>root</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Function</td>          <td class="paramname"><span class="paramname"><em>F</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印根和他的所有孩子 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>遍历的模式 </td></tr>
    <tr><td class="paramname">root</td><td>根 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a name="doc-related-members" id="doc-related-members"></a><h2 id="header-doc-related-members" class="groupheader">Friends And Related Symbol Documentation</h2>
<a id="aa1da950e13ff2a3c6fcaca11015a4e20" name="aa1da950e13ff2a3c6fcaca11015a4e20"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa1da950e13ff2a3c6fcaca11015a4e20">&#9670;&#160;</a></span>operator&lt;&lt;</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ostream &amp; operator&lt;&lt; </td>
          <td>(</td>
          <td class="paramtype">ostream &amp;</td>          <td class="paramname"><span class="paramname"><em>os</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>Tree</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel friend">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>操作符重载&lt;&lt; </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ostream</td><td>输出流 </td></tr>
    <tr><td class="paramname">Tree</td><td>要输出的根 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<a id="a9aa06543930fa8ddb21c1ebabbff3ecf" name="a9aa06543930fa8ddb21c1ebabbff3ecf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9aa06543930fa8ddb21c1ebabbff3ecf">&#9670;&#160;</a></span>print_node</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void print_node </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__tree.html">my_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>Tree</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>x</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel friend">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>打印节点，后续用来bind之后传入traversal </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Tree</td><td>要输出的根 </td></tr>
    <tr><td class="paramname">x</td><td>要输出的第x个节点 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>统一采用孩子双亲表示法 </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="my__tree_8h_source.html">my_tree.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a href="classmy__tree.html">my_tree</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
  </ul>
</div>
</body>
</html>
